package io.renren.modules.app.service.impl;

import io.renren.modules.app.service.ApiCollectService;
import io.renren.modules.sys.dao.SongCollectDao;
import io.renren.modules.sys.dao.SongsetCollectDao;
import io.renren.modules.sys.dao.TeachCollectDao;
import io.renren.modules.sys.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @author wangyi
 * @mail 794651397@qq.com
 * @createdate 2018/3/19 12:57
 **/
@Service("ApiCollectService")
public class ApiCollectServiceImpl implements ApiCollectService {
    @Autowired
    private SongCollectDao songCollectDao;
    @Autowired
    private SongsetCollectDao songsetCollectDao;
    @Autowired
    private TeachCollectDao teachCollectDao;

    @Override
    public void collectSong(SongCollectEntity songCollectEntity) {
        songCollectDao.save(songCollectEntity);
    }

    @Override
    public void cancelCollectSong(SongCollectEntity songCollectEntity) {
        songCollectDao.delCollectSong(songCollectEntity);
    }

    @Override
    public void collectSongset(SongsetCollectEntity songsetCollectEntity) {
        songsetCollectDao.save(songsetCollectEntity);
    }

    @Override
    public void cancelCollectSongset(SongsetCollectEntity songsetCollectEntity) {
        songsetCollectDao.delCollectSongset(songsetCollectEntity);
    }

    @Override
    public void collectTeach(TeachCollectEntity teachCollectEntity) {
        teachCollectDao.save(teachCollectEntity);
    }

    @Override
    public void cancelCollectTeach(TeachCollectEntity teachCollectEntity) {
        teachCollectDao.delCollectTeach(teachCollectEntity);
    }

    @Override
    public List<SongEntity> collectSongList(Long userId) {
        return songCollectDao.collectSongList(userId);
    }

    @Override
    public List<SongsetEntity> collectSongsetList(Long userId) {
        return songsetCollectDao.collectSongsetList(userId);
    }

    @Override
    public List<TeachEntity> collectTeachList(Long userId) {
        return teachCollectDao.collectTeachList(userId);
    }

    @Override
    public int songsetCollectCount(HashMap<String, Object> map) {
        return songsetCollectDao.songsetCollectCount(map);
    }

    @Override
    public int songCollectCount(HashMap<String, Object> map) {
        return songCollectDao.songCollectCount(map);
    }

    @Override
    public int teachCollectCount(HashMap<String, Object> map) {
        return teachCollectDao.teachCollectCount(map);
    }
}
